using System;
using UnityEngine;
using System.Collections;
using LogicalComponent.rules.grid;
using LogicalComponent.util;

public class MoveRulesUI : MonoBehaviour {

    public enum AdjacencyType {
        HEX, SQUARE
    }

    public int OrthagonalCost;
    public int DiagonalCost;
    public int AnywhereCost;
    /*
     * temporarily set costs as int until
     * Fractions have a constructor that
     * accepts float values.
     *
     * Change back once implemented
     *
    public float OrthagonalCost;
    public float DiagonalCost;
    public float AnywhereCost;
    */
    public bool NeedsFullCost;

    public AdjacencyType adjacencyType = AdjacencyType.SQUARE;

    public MoveRuleSet RuleSet { private set; get; }

    void Start ()
    {
        GameObject grid = GameObject.FindGameObjectWithTag("grid");

        if (this.adjacencyType == AdjacencyType.SQUARE)
        {
            SquareMoveRuleSet squareSet = new SquareMoveRuleSet(grid.GetComponent<Grid>());
            squareSet.OrthagonalCost = new Fraction(OrthagonalCost);
            squareSet.DiagonalCost = new Fraction(DiagonalCost);
            squareSet.MinDiagonalCost = new Fraction(DiagonalCost);
            squareSet.MinOrthagonalCost = new Fraction(OrthagonalCost);
            squareSet.NeedsFullCost = NeedsFullCost;
            this.RuleSet = squareSet;
        }
        else
        {
            throw new NotImplementedException();
        }
    }
}
